<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>工会整理</title>
    <link rel="stylesheet" href="/static/css/style.css">
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>

<body>
    <nav class="navbar">
        <div class="container navbar-container"
            style="margin: 0; max-width: none; display: flex; justify-content: space-between;">
            <a class="navbar-brand" href="/">
                <img src="/static/128431.ico" alt="Logo" style="height: 30px;">
                PCR 渠道服工具箱
            </a>
            <div class="navbar-menu">
                <!-- Hidden from main menu but accessible -->
            </div>
        </div>
    </nav>

    <div class="container fade-in">
        <div class="card">
            <div class="card-header">
                工会整理
            </div>
            <div class="grid">
                <div class="form-group">
                    <input type="text" id="clanid" class="form-control" placeholder="工会ID">
                </div>
                <div class="form-group">
                    <input type="text" id="passwd" class="form-control" placeholder="验证密码">
                </div>
            </div>
            <div class="form-group" style="display: flex; gap: 1rem;">
                <button class="btn" id="b01">清理所有</button>
                <button class="btn btn-secondary" id="b02">清理其他</button>
            </div>
        </div>

        <div class="card" id="resultCard" style="display: none;">
            <div id="myDiv"></div>
        </div>
    </div>

    <script>
        $(function () {
            function sendRequest(type) {
                $.ajax({
                    url: "remove_user",
                    type: "POST",
                    dataType: "text",
                    data: {
                        clanid: $("#clanid").val(),
                        passwd: $("#passwd").val(),
                        type: type
                    },
                    success: function (data) {
                        $("#resultCard").show();
                        $("#myDiv").html(data);
                    },
                    error: function () {
                        $("#resultCard").show();
                        $("#myDiv").html("操作失败");
                    }
                })
            }

            $("#b01").click(function () {
                sendRequest("remove");
            });
            $("#b02").click(function () {
                sendRequest("clean");
            });
        })
    </script>
</body>

</html>